package cn.skyquant.quant4j.service.boot.model.forex;

import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ForexConfigSeriesRepository extends CrudRepository<ForexConfigSeries, Integer> {
    Sort forexConfigSeriesSort = new Sort(Sort.Direction.ASC,"i");
    void deleteByConfig(ForexConfig config);

    @Modifying
    @Query("delete from ForexConfigSeries u where u.config.id = ?1")
    void deleteByConfigId(Integer configId);

    List<ForexConfigSeries> findByConfig(ForexConfig config, Sort sort);
}
